package com.bw.goods.mvvm.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import com.bw.goods.R;
import com.youth.banner.adapter.BannerAdapter;

import java.util.List;

public
/**
 * @author Lishaohe
 * @description:
 * @date :2021/10/15 0015 上午 11:14
 *
 */
class HomeTxtBannerAdapter extends BannerAdapter<String, HomeTxtBannerAdapter.HomeTxtBannerViewHolder> {

    public HomeTxtBannerAdapter(List<String> datas) {
        super(datas);
    }

    @Override
    public HomeTxtBannerViewHolder onCreateHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_home_txt_banner,parent,false);
        ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
        itemView.setLayoutParams(lp);
        return new HomeTxtBannerViewHolder(itemView);

    }

    @Override
    public void onBindView(HomeTxtBannerViewHolder holder, String data, int position, int size) {
        holder.txtbanner_item.setText(data);
    }

    public static class HomeTxtBannerViewHolder extends RecyclerView.ViewHolder {
        TextView txtbanner_item;
        public HomeTxtBannerViewHolder(  View itemView) {
            super(itemView);
            txtbanner_item = itemView.findViewById(R.id.txtbanner_item);
        }
    }

}
